<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head >
    <th:block th:include="include :: header('添加远程踏勘')"/>
    <th:block th:include="include :: datetimepicker-css" />
</head>
<!--<link th:href="@{/ajax/libs/datapicker/bootstrap-datetimepicker.min.css}" type="text/css" rel="stylesheet"></link>-->
<!--<link th:href="@{/ajax/libs/bootstrap-select/dist/css/bootstrap-select.css}" type="text/css" rel="stylesheet"></link>-->
<body class="white-bg">
<style>
    .form-control {
        border-top-right-radius: 10px;
        border-top-left-radius: 10px;
        border-bottom-right-radius: 10px;
        border-bottom-left-radius: 10px;
    }
</style>
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-project-add">
        <input  type="hidden" name="ids" id="ids" th:value="${yctk}!=null?${yctk.id}:''">
        <div class="form-group">
            <label class="col-sm-2 control-label">经营者类型：</label>
            <div class="col-sm-4">
                <div class="radio-box">
                    <input   id="z1"  type="radio"  name="manageType" th:value="个体" >
                    <label  value="个体" th:for="z1" text="个体">个体</label>
                </div>
<!--                th:checked="*{zwzh1==zwzh}"-->
                <div   class="radio-box">
                    <input id="z2" type="radio"   name="manageType" value="企业" >
                    <label   value="企业" th:for="z2" text="企业">企业</label>
                </div>
            </div>
            <label class="col-sm-2 control-label">经营者名称：</label>
            <div class="col-sm-4">
                <input name="qyName" autocomplete="off" class="form-control required" type="text"
                       maxlength="30" required
                       th:value="${yctk}!=null?${yctk.qyName}:''">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">经营者（业主）名称：</label>
            <div class="col-sm-4">
                <input name="username" class="form-control required" type="text"
                       th:value="${yctk}!=null?${yctk.sfzcard}:''" required>
            </div>
            <label class="col-sm-2 control-label">经营者（业主）联系电话：</label>
            <div class="col-sm-4">
                <input  name="phone" autocomplete="off" class="form-control required"
                               type="text" maxlength="11" required
                               th:value="${yctk}!=null?${yctk.phone}:''" >
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">身份证号：</label>
            <div class="col-sm-4">
                <input name="sfzcard" class="form-control required" type="text"
                       th:value="${yctk}!=null?${yctk.sfzcard}:''" required>
            </div>
            <label class="col-sm-2 control-label">经营场所地址：</label>
            <div class="col-sm-4">
                <input  name="qyAddress" autocomplete="off" class="form-control required"
                       type="text"  required
                       th:value="${yctk}!=null?${yctk.phone}:''" >
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">生产经营场所面积（平方米）：</label>
            <div class="col-sm-4">
                <input name="acreage" autocomplete="off" class="form-control required" type="text"
                       maxlength="30" required
                       th:value="${yctk}!=null?${yctk.qyName}:''">
            </div>

            <label class="col-sm-2 control-label">主体业态：</label>
             <div class="col-sm-4">
                <select class="form-control" name="ztyt" >
                  <option th:value="小餐饮">小餐饮</option>
                  <option th:value="小餐桌">小餐桌</option>
                  <option th:value="社区老人照料餐厅">社区老人照料餐厅</option>
                  <option th:value="其他">其他</option>
                  <option th:value="幼儿园">幼儿园</option>
                </select>
             </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">食品制售：</label>
            <div class="col-sm-4">
                <select class="form-control" name="spzs" >
                    <option th:value="热食类食品制售">热食类食品制售</option>
                    <option th:value="冷食类食品制售">冷食类食品制售</option>
                    <option th:value="糕点类食品制售">糕点类食品制售</option>
                    <option th:value="自制饮品制售">自制饮品制售</option>
                </select>
            </div>
            <label class="col-sm-2 control-label">完成时限(工作日)：</label>
            <div class="col-sm-4">
                <input name="wcTime" autocomplete="off" class="form-control " type="text" maxlength="30"
                       th:value="${yctk}!=null?${yctk.qyAddress}:'10'"  required>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">受理时间：</label>
            <div class="col-sm-4">
                <div class="input-group date">
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    <input id="makedate" name="makedate" type="text" class="form-control required"
                           th:value="${yctk}!=null?${strDate}:''" onchange="function1()" >
                </div>
            </div>
            <label class="col-sm-2 control-label">截止时间：</label>
            <div class="col-sm-4">
                <input name="cutoffTime" autocomplete="off" class="form-control " type="text" maxlength="30"
                       th:value="${yctk}!=null?${yctk.qyAddress}:''"  required>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label" >踏勘人员：</label>
            <div class="col-sm-4" id="dianji" >
                    <input  id="tk_realname" name="tk_realname" autocomplete="off" class="form-control required" type="text"
                            th:value="${yctk}!=null?${yctk.tk_realname}:''"   maxlength="30" required>
            </div>
            <label class="col-sm-2 control-label">踏勘人员联系电话：</label>
            <div class="col-sm-4">
                <input id="tk_phone"name="tk_phone" autocomplete="off"  class="form-control " type="text" maxlength="30"
                       th:value="${yctk}!=null?${yctk.tk_phone}:''"  required>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12" style="text-align:center">
                <button  type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i
                        class="fa fa-check"></i>保 存
                </button>&nbsp;
                <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i
                        class="fa fa-reply-all"></i>关 闭
                </button>
            </div>
        </div>
    </form>
</div>

<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/datapicker/bootstrap-datetimepicker.min.js}"></script>
<script type="text/javascript">
    if(true){
        if([[${login}]]){
            document.getElementById('tk_realname').setAttribute('disabled', 'disabled');
            document.getElementById('tk_phone').setAttribute('disabled', 'disabled')

        }else{
            $(function () {
                //给返回首页修改密码按钮添加单击事件
                $("#dianji").on("click", function () {
                    selectDeptTree();
                });
            })
        }
    }
    var prefix = ctx + "Rong";
    $("#makedate").datetimepicker({
        format: "yyyy-mm-dd hh:ii",
        autoclose: true
    });

    function submitHandler() {
        if([[${change}]]){
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/add", $('#form-project-add').serialize());
            }
        }else{
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/upedit/"+$("#ids").val(), $('#form-project-add').serialize());
            }
        }

    }


    function selectDeptTree() {
        var url =  "/Rong/person";
        var options = {
            title: '选择勘察人员',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero) {
        var treeObj = layero.find("iframe")[0].contentWindow.$._tree,
            nodes = treeObj.getCheckedNodes(true),
            treeNames = [],
            treeIds = [];
        for (var i = 0; i < nodes.length; i++) {
                treeNames.push(nodes[i].name);
                treeIds.push(nodes[i].id);
        }
        $("#tk_realname").val(treeNames);
        layer.close(index);
    }
    function sldate()
    {
        var makedate = $("#makedate").val();
       alert(makedate)
    }
    $("#makedate").change(function(){
        var makedate = $("#makedate").val();
        var formData = new FormData();
        formData.append('date',makedate);
        $.ajax({
            url:'/Rong/columnList',
            type: 'post',
            cache: false,
            data: formData,
            dataType: 'json',
            contentType:false,
            processData: false,
            error: function () {
                alert('暂时无法操作，请刷新后再试！');
            },
            success: function (result) {

            }
        });
    });
</script>
</body>
</html>
